package com.hw.one.peach.da.service;

import java.util.ArrayList;
import java.util.List;

public enum VOCsEnum {
	// 三大类
	B1("非甲烷碳氢化合物", null, "a07001", 0),
	B2("卤代烃类VOCs", null, "a07002", 0),
	B3("含氧（氮）VOCs", null, "a07003", 0),
	
	// 14小类
	M1("低碳烷烃C2-C5", B1, "a06001", 0),
	M2("低碳烯烃C2-C5", B1, "a06002", 0),
	M3("高碳烷烃C6-C12", B1, "a06003", 0),
	M4("高碳烯烃C6-C12", B1, "a06004", 0),
	M5("炔烃", B1, "a06005", 0),
	M6("苯系物", B1, "a06006", 0),
	
	M7("氟利昂", B2, "a06007", 0),
	M8("卤代烷烃", B2, "a06008", 0),
	M9("卤代烯烃", B2, "a06009", 0),
	M10("卤代芳香烃", B2, "a06010", 0),
	
	M11("醛类有机物", B3, "a06011", 0),
	M12("酮类有机物", B3, "a06012", 0),
	M13("醚类有机物", B3, "a06013", 0),
	M14("含氮有机物", B3, "a06014", 0),
	
	// 组分
	COM1("乙烷",M1, "a05001",30),
	COM2("丙烷",M1, "a05002",44),
	COM3("异丁烷",M1, "a05003",58),
	COM4("正丁烷",M1, "a05004",58),
	COM5("环戊烷",M1, "a05005",70),
	COM6("异戊烷",M1, "a05006",72),
	COM7("正戊烷",M1, "a05007",72),
	COM8("乙烯",M2, "a05008",28),
	COM9("丙烯",M2, "a05009",42),
	COM10("反-2-丁烯",M2, "a05010",56),
	COM11("1-丁烯",M2, "a05011",56),
	COM12("顺-2-丁烯",M2, "a05012",56),
	COM13("1-戊烯",M2, "a05013",70),
	COM14("1,3-丁二烯",M2, "a05014",54),
	COM15("异丁烯",M2, "a05015",56),
	COM16("反-2-戊烯",M2, "a05016",70),
	COM17("异戊二烯",M2, "a05017",68),
	COM18("顺-2-戊烯",M2, "a05018",70),
	COM19("2,2-二甲基丁烷",M3, "a05019",86),
	COM20("2,3-二甲基丁烷",M3, "a05020",86),
	COM21("2-甲基戊烷",M3, "a05021",86),
	COM22("3-甲基戊烷",M3, "a05022",86),
	COM23("正己烷",M3, "a05023",86),
	COM24("2,4-二甲基戊烷",M3, "a05024",100),
	COM25("甲基环戊烷",M3, "a05025",84),
	COM26("2-甲基己烷",M3, "a05026",100),
	COM27("环己烷",M3, "a05027",84),
	COM28("2,3-二甲基戊烷",M3, "a05028",100),
	COM29("3-甲基己烷",M3, "a05029",100),
	COM30("2,2,4-三甲基戊烷",M3, "a05030",114),
	COM31("正庚烷",M3, "a05031",100),
	COM32("甲基环己烷",M3, "a05032",98),
	COM33("2,3,4-三甲基戊烷",M3, "a05033",114),
	COM34("2-甲基庚烷",M3, "a05034",114),
	COM35("3-甲基庚烷",M3, "a05035",114),
	COM36("辛烷",M3, "a05036",114),
	COM37("正壬烷",M3, "a05037",128),
	COM38("正癸烷",M3, "a05038",142),
	COM39("十一烷",M3, "a05039",156),
	COM40("十二烷",M3, "a05040",170),
	COM41("1-己烯",M4, "a05041",84),
	COM42("乙炔",M5, "a05042",26),
	COM43("苯",M6, "a05043",78),
	COM44("甲苯",M6, "a05044",92),
	COM45("乙苯",M6, "a05045",106),
	COM46("间/对二甲苯",M6, "a05046",106),
	COM47("邻二甲苯",M6, "a05047",106),
	COM48("苯乙烯",M6, "a05048",104),
	COM49("异丙苯",M6, "a05049",120),
	COM50("正丙基苯",M6, "a05050",120),
	COM51("3-乙基甲苯",M6, "a05051",120),
	COM52("4-乙基甲苯",M6, "a05052",120),
	COM53("1,3,5-三甲基苯",M6, "a05053",120),
	COM54("2-乙基甲苯",M6, "a05054",120),
	COM55("1,2,4-三甲基苯",M6, "a05055",120),
	COM56("1,2,3-三甲基苯",M6, "a05056",120),
	COM57("1,3-二乙基苯",M6, "a05057",134),
	COM58("1,4-二乙基苯",M6, "a05058",134),
	COM59("氟利昂114",M7, "a05059",170),
	COM60("氟利昂11",M7, "a05060",136),
	COM61("氟利昂113",M7, "a05061",186),
	COM62("氯甲烷",M8, "a05062",50),
	COM63("溴甲烷",M8, "a05063",94),
	COM64("氯乙烷",M8, "a05064",64),
	COM65("二氯甲烷",M8, "a05065",84),
	COM66("1,1-二氯乙烷",M8, "a05066",98),
	COM67("三氯甲烷",M8, "a05067",118),
	COM68("1,1,1-三氯乙烷",M8, "a05068",132),
	COM69("四氯化碳",M8, "a05069",152),
	COM70("1,2-二氯乙烷",M8, "a05070",98),
	COM71("1,2-二氯丙烷",M8, "a05071",112),
	COM72("一溴二氯甲烷",M8, "a05072",162),
	COM73("1,1,2-三氯乙烷",M8, "a05073",132),
	COM74("1,2-二溴乙烷",M8, "a05074",186),
	COM75("溴仿",M8, "a05075",250),
	COM76("1,1,2,2-四氯乙烷",M8, "a05076",166),
	COM77("碘甲烷",M8, "a05077",141),
	COM78("氯乙烯",M9, "a05078",62),
	COM79("1,1-二氯乙烯",M9, "a05079",96),
	COM80("顺-1,2-二氯乙烯",M9, "a05080",96),
	COM81("三氯乙烯",M9, "a05081",130),
	COM82("反式-1,3-二氯丙烯",M9, "a05082",110),
	COM83("顺式-1,3-二氯丙烯",M9, "a05083",110),
	COM84("四氯乙烯",M9, "a05084",164),
	COM85("氯苯",M10, "a05085",112),
	COM86("1,3-二氯苯",M10, "a05086",146),
	COM87("1,4-二氯苯",M10, "a05087",146),
	COM88("苄基氯",M10, "a05088",126),
	COM89("邻二氯苯",M10, "a05089",146),
	COM90("丙烯醛",M11, "a05090",56),
	COM91("丙醛",M11, "a05091",58),
	COM92("2-甲基丙烯醛",M11, "a05092",70),
	COM93("丁醛",M11, "a05093",72),
	COM94("戊醛",M11, "a05094",86),
	COM95("正己醛",M11, "a05095",100),
	COM96("丙酮",M12, "a05096",58),
	COM97("丁烯酮",M12, "a05097",70),
	COM98("2-丁酮",M12, "a05098",72),
	COM99("2-戊酮",M12, "a05099",86),
	COM100("3-戊酮",M12, "a05100",86),
	COM101("甲基叔丁基醚",M13, "a05101",88),
	COM102("乙腈",M14, "a05102",41)
	;
	
	// 中文名称
	private String name;
	// 英文名称
	private VOCsEnum parent;
	
	private String code;
	
	private float rmm;

	public String getName() {return name;}

	public VOCsEnum getParent() {return parent;}

	public String getCode() {return code;}
	
	public float getRmm() {return rmm;}
	
	public static List<VOCsEnum> getChild(VOCsEnum v){
		List<VOCsEnum> cs = new ArrayList<VOCsEnum>();
		
		for (VOCsEnum voCsCat : VOCsEnum.values()) {
			if (voCsCat.getParent() != null && voCsCat.getParent().getCode().equals(v.getCode())) {
				cs.add(voCsCat);
			}
		}
		return cs;
	}
	
	public static List<VOCsEnum> getRoot(){
		List<VOCsEnum> cs = new ArrayList<VOCsEnum>();
		for (VOCsEnum voCsCat : VOCsEnum.values()) {
			if (voCsCat.getParent() == null) {
				cs.add(voCsCat);
			}
		}
		return cs;
	}
	
	public static List<String> getAllComponent() {
		List<String> components = new ArrayList<String>();
		for (VOCsEnum voc : VOCsEnum.values()) {
			if (voc.name().contains("COM")) {
				components.add(voc.getCode());
			}
		}
		return components;
	}

	public static float getRmmByIncode(String code) {
		float rmm = 0;
		for (VOCsEnum voc : VOCsEnum.values()) {
			if (voc.getCode().equals(code)) {
				rmm = voc.getRmm();
				break;
			}
		}
		
		return rmm;
	}
	
	VOCsEnum(String name, VOCsEnum parent, String code, float rmm) {
		this.name = name;
		this.parent = parent;
		this.code = code;
		this.rmm = rmm;
	}
}
